<?php

/**
 * BuddyPress - Users Header
 *
 * @package BuddyPress
 * @subpackage bp-default
 */

?>

<?php do_action( 'bp_before_member_header' ); ?>

<p class="page-title">
    <?php bp_displayed_user_fullname(); ?>
</p>

<div id="item-header-avatar">
	<a href="<?php bp_displayed_user_link(); ?>">

		<?php bp_displayed_user_avatar( 'type=full' ); ?>

	</a>
</div><!-- #item-header-avatar -->

<div id="item-header-content">
    
	<?php if ( is_ssa(bp_displayed_user_id()) ) { ?>
        <div id="rating">
            <h4>Assistant Rating</h4>
            <?php ssa_rating_show( bp_displayed_user_id() ); ?>
        </div>
        
		<?php if ( bp_get_member_profile_data( 'field=Accepting New Files:' ) == 'Yes' ) { ?>
			<?php if ( is_user_logged_in() ) { ?>
                <a id="makePerfferedAgent" href="<?php echo site_url('submit-short-sale') . '?ssaID=' . bp_displayed_user_id(); ?>">Make preferred Assistant<br />
                & Submit a Listing</a>
            <?php } else { ?>
                <?php
                    $redirectTo = site_url('submit-short-sale') . '?ssaID=' . bp_displayed_user_id();
                    $loginAndRedirectLink = wp_login_url( $redirectTo );
                ?>
                <a id="makePerfferedAgent" href="<?php echo $loginAndRedirectLink; ?>">Make preferred Assistant<br />
                & Submit a Listing</a>
			<?php } ?>
		<?php } else { ?>
        <span id="makePerfferedAgent">Sorry, this Assistant is not accepting<br />
		files from new Agent / Partners.</span>
        <?php } ?>
	<?php } ?>
    
	<?php do_action( 'bp_before_member_header_meta' ); ?>

	<div id="item-meta">

		<?php
		/***
		 * If you'd like to show specific profile fields here use:
		 * bp_member_profile_data( 'field=About Me' ); -- Pass the name of the field
		 */
		 do_action( 'bp_profile_header_meta' );

		 ?>

	</div><!-- #item-meta -->

</div><!-- #item-header-content -->

<?php do_action( 'bp_after_member_header' ); ?>

<?php do_action( 'template_notices' ); ?>